#!/usr/bin/env bash
set -euo pipefail

# Not running in container cause git creds aren't in there

NUM=$1
LOCAL_BRANCH="pr-${NUM}"
REMOTE_BRANCH="pull/${NUM}/head"


git checkout main

git branch -D "pr-${NUM}" || true
git fetch origin "${REMOTE_BRANCH}:${LOCAL_BRANCH}" 
git checkout "${LOCAL_BRANCH}"

